<head>
<title>quasi 0.1</title>
<style>
div {overflow: scroll; font-family: monospace; font-size: 19px; font-weight: bold;}
textarea {overflow: scroll; font-family: monospace; font-size: 19px; font-weight: bold;}
</style>
</head>

<body>
<span id="progrun">
</span>
<div id="dtop" style="position: absolute; top: 1%; left: 1%; width: 98%; height: 35%;"><br>&nbsp;display window</div>
<textarea id="dleft" style="position: absolute; top: 38%; left: 1%; width: 32%; height: 58%;">

text in</textarea>
<div id="dmid" style="position: absolute; top: 38%; left: 35%; width: 64%; height: 58%;"
onclick="javascript:textparse();"><br>&nbsp;program editor (not implemented yet)<br><br>&nbsp;click here to run program in import/export window on left<br><br></div>

<script>
dtop.style.background = 'white'; dtop.style.bordercolor = 'black'; dtop.style.border = 'solid';

dleft.style.background = 'white'; dleft.style.bordercolor = 'black'; dleft.style.border = 'solid';
// dleft.innerHTML = "<textarea style='width: 100%; height: 100%;'></textarea>";

dmid.style.background = 'white'; dmid.style.bordercolor = 'black'; dmid.style.border = 'solid';

function q_cls() { 
    if (progrun.innerHTML == "<!-- -->") { return 0; } 
    dtop.innerHTML = ""; 
    }

function q_end() { 
    progrun.innerHTML = "<!-- -->"; 
    }

function q_print(p) { 
    if (progrun.innerHTML == "<!-- -->") { return 0; } 
    dtop.innerHTML = dtop.innerHTML + p + "<br>\n"; 
    }

function right(s, l) {
    return s.substring(s.length-l, s.length);
    }

function textparse() { 
    progrun.innerHTML = "";
    var p = " ";
    var cc = dleft.innerHTML + "\n";
    var codeout = "";
    for(count = 0; count < cc.length; count++){
        p += cc.substring(count, count + 1);
        if (right(p, 5) == " cls\n" || right(p, 5) == " cls ") { codeout += "q_cls(); "; p = " "; }
        if (right(p, 5) == " end\n" || right(p, 5) == " end ") { codeout += "q_end(); "; p = " "; }
        if (right(p, 7) == " print\n" || right(p, 7) == " print ") { codeout += "q_print(0); "; p = " "; }
        }
    if (codeout != "") { eval(codeout); }
    }

dtop.innerHTML = "<br>" + document.title + "<br>Copyright (C) 2020 mn<br><br>This program is free software: you can redistribute it and/or modify it under the terms of the <a href='gpl-3.0.txt'>GNU General Public License</a> as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br><br>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.<br><br>You should have received a copy of the GNU General Public License along with this program. If not, see <a href='https://www.gnu.org/licenses/'>https://www.gnu.org/licenses/</a>.";

demo = "hello cls\n\
there print end\n\
hello print";

if (demo != "") { dleft.innerHTML = "\n" + demo; demo = "";}

</script>
</body>
